/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package z.h.w.jar.data.time;

/**
 *
 * @author EnzoZhong
 */
public enum Unit implements UnitApi {

      /**
       *
       */
      MILLISECOND ( 1.0 ),
      /**
       *
       */
      SECOND ( 1000.0 ),
      /**
       *
       */
      MINUTE ( SECOND.getUnit () * 60 ),
      /**
       *
       */
      HOUR ( MINUTE.getUnit () * 60 ),
      /**
       *
       */
      DAY ( HOUR.getUnit () * 24 ),
      /**
       *
       */
      WEEK ( DAY.getUnit () * 7 ),
      /**
       *
       */
      MONTH ( DAY.getUnit () * 30.4375 ),
      /**
       *
       */
      SEASON ( MONTH.getUnit () * 3 ),
      /**
       *
       */
      YEAR ( DAY.getUnit () * 365.25 ),
      /**
       *
       */
      CENTURY ( YEAR.getUnit () * 100 );
      private Double unit;

      private Unit ( Double unit ) {
            this.unit = unit;
      }

      /**
       *
       * @param multiple
       *
       * @return
       */
      @Override
      public Long convert ( Integer multiple ) {
            return convert ( multiple * unit ).longValue ();
      }

      @Override
      public Double convert ( Double multiple ) {
            return multiple * unit;
      }

      /**
       * 获取该单位的值
       *
       * @return
       */
      @Override
      public Double getUnit () {
            return unit;
      }

}
